package com.p2p.model;

import com.p2p.define.P2PRoomType;

import java.util.HashMap;
import java.util.Map;

public class P2PRoom {

    private String id;
    private String name;
    private P2PRoomType roomType;

    private Map<String, P2PUser> userMap = new HashMap<>();

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void addUser(P2PUser user) {
        this.userMap.put(user.getId(), user);
    }

    public void removeUser(P2PUser user) {
        this.userMap.remove(user.getId());
    }

    public P2PUser getUser(P2PUser user) {
        return this.userMap.get(user.getId());
    }

    public P2PRoomType getType() {
        return roomType;
    }

    public void setType(P2PRoomType type) {
        this.roomType = type;
    }

    public void setType(int roomType) {
        if(roomType == 0){
            this.roomType = P2PRoomType.Text;
        }else{
            this.roomType = P2PRoomType.Media;
        }
    }


    public void dataChannelTalk(String message) {

    }

    public void onPause() {

    }

    public void onResume() {

    }

    public void onDestroy() {

    }
}
